import request from '@/utils/request'

// 系统登录方法
export function systemLogin(username, password, code, uuid) {
  const data = {username, password, code, uuid};
  return request({
    url: '/systemLogin',
    headers: {isToken: false, repeatSubmit: false},
    method: 'post',
    data: data
  })
}

// 系统注册方法
export function systemRegister(data) {
  return request({
    url: '/systemRegister',
    headers: {isToken: false},
    method: 'post',
    data: data
  })
}

// 商家登录方法
export function sellerLogin(username, password, code, uuid) {
  const data = {username, password, code, uuid};
  return request({
    url: '/sellerLogin',
    headers: {isToken: false, repeatSubmit: false},
    method: 'post',
    data: data
  })
}

// 商家注册方法
export function sellerRegister(data) {
  return request({
    url: '/sellerRegister',
    headers: {isToken: false},
    method: 'post',
    data: data
  })
}

// 客户登录方法
export function clientLogin(username, password, code, uuid) {
  const data = {username, password, code, uuid};
  return request({
    url: '/sellerLogin',
    headers: {isToken: false, repeatSubmit: false},
    method: 'post',
    data: data
  })
}

// 客户注册方法
export function clientRegister(data) {
  return request({
    url: '/clientRegister',
    headers: {isToken: false},
    method: 'post',
    data: data
  })
}

// 获取系统用户详细信息
export function getUserInfo() {
  return request({
    url: '/getUserInfo',
    method: 'get'
  })
}

// 获取商家详细信息
export function getSellerInfo() {
  return request({
    url: '/getSellerInfo',
    method: 'get'
  })
}

// 获取客户详细信息
export function getClientInfo() {
  return request({
    url: '/getClientInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}
